package com.yizhang.xml.listener;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * @Author: yi.zhang
 * @CreateTime: 2025-06-19 14:09:27
 * @Description: 监听器
 */
//@WebListener
//public class ContextLoaderListener implements ServletContextListener {
//
//    private static final String CONTEXT_CONFIG_LOCATION = "contextConfigLocation";
//
//    @Override
//    public void contextInitialized(ServletContextEvent sce) {
//        System.out.println("contextInitialized==================");
//        ServletContext application = sce.getServletContext();
//        String contextConfigLocation = application.getInitParameter(CONTEXT_CONFIG_LOCATION);
//        contextConfigLocation = contextConfigLocation.substring("classpath:".length());
//        ApplicationContext context = new ClassPathXmlApplicationContext(contextConfigLocation);
//        application.setAttribute("applicationContext", context);
//    }
//}
